package capricornus.actor
{
	import flash.utils.Dictionary;

	public class ActorManager
	{
		public static const instance:ActorManager = new ActorManager();
		
		private var _dictActors:Dictionary;
		
		public function ActorManager()
		{
			init();
		}
		
		private function init():void
		{
			_dictActors = new Dictionary();
		}
		
		internal function addActor( actor:Actor ):void
		{
			_dictActors[actor.attribute.id] = actor;
		}
		
		internal function removeActor( actor:Actor ):void
		{
			var id:String = actor.attribute.id;
			if( _dictActors[id] != null )
			{
				delete _dictActors[id];
			}
		}
		
		public function refreshAllActor( time:Number ):void
		{
			for( var i:* in _dictActors )
			{
				var actor:Actor = _dictActors[i];
				actor.refresh( time );
			}
		}
	}
}